#include <iostream>

using namespace std;


class A {
    public:
        A() {
            cout << "A()" << endl;
            aptr = new char[100];
        }
       
        ~A() {
            cout << "~A()" << endl;
            delete [] aptr;
        }
    private:
        char * aptr;    
};
class B:public A{
    public:
        B() {
            cout << "B()" << endl;
            bptr = new char[100];
        }
        ~B() {
            cout << "~B()" << endl;
            delete[] bptr;

        }
    private:
        char * bptr;    
};
void free_function(A *p) {
    delete p;
}


int main(int argc, char const *argv[])
{
    A * aObject = new A;
    free_function(aObject);

    cout << "=======================" << endl;
    B * bObject = new B;
    free_function(bObject);
    //  b对象指针没有被释放？ 解析器导致的
    return 0;
}
